package com.smartrm.trade.domain;

/*
 * @program: common-starters
 * @description: 订单状态
 * @author: houhong
 * @create: 2023-01-10 16:04
 */
public enum OrderState {

    /*
     * 订单开始创建，
     */
    Start(0),
    /*
     * 订单创建成工，
     */
    Success(1),
    /*
     * 订单取消
     */
    Canceled(2);

    private final int code;

    private OrderState(int code) {
        this.code = code;
    }

    public int code() {
        return code;
    }

    public static OrderState of(int code) {
        for (OrderState state : values()) {
            if (state.code == code) {
                return state;
            }
        }
        return null;
    }
}